﻿using FreeSql.DataAnnotations;
using System;

namespace LF.Domain.Entities
{
    /// <summary>
    /// 部门
    /// </summary>
    [Table(Name = "SysDeptment")]
    public class Deptment : BaseEntity
    {
        /// <summary>
        /// 部门名称
        /// </summary>
        public string DeptName { get; set; }
        /// <summary>
        /// 部门编码
        /// </summary>
        public string DeptCode { get; set; }
        /// <summary>
        /// 上一级部门ID
        /// </summary>
        public Guid? SupDeptId { get; set; }
        /// <summary>
        /// 所有上级部门编码
        /// </summary>
        public string SupDeptCode { get; set; }
        /// <summary>
        /// 所有上级部门ID
        /// </summary>
        public string AllSupDeptId { get; set; }
        /// <summary>
        /// 是否启用
        /// </summary>
        public bool Active { get; set; }
        /// <summary>
        /// 层级
        /// </summary>
        public string TLevel { get; set; }

        /// <summary>
        /// 排序号
        /// </summary>
        public int OrderNo { get; set; }

        /// <summary>
        /// 父部门
        /// </summary>
        [Navigate(nameof(SupDeptId))]
        public virtual Deptment Parent { get; set; }

        /// <summary>
        /// 子部门
        /// </summary>
        [Navigate(nameof(SupDeptId))]
        public virtual List<Deptment> Children { get; set; }
    }
}
